<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QScriptString Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QScriptString Class Reference<br /><sup><sup>[<a href="qtscript.html">QtScript</a> module]</sup></sup></h1><p>The QScriptString class acts as a handle to "interned" strings
in a <a href="qscriptengine.html">QScriptEngine</a>. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qscriptstring.html#QScriptString">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qscriptstring.html#QScriptString-2">__init__</a></b> (<i>self</i>, QScriptString&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qscriptstring.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />(int, bool&#160;<i>ok</i>) <b><a href="qscriptstring.html#toArrayIndex">toArrayIndex</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qscriptstring.html#toString">toString</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qscriptstring.html#__eq__">__eq__</a></b> (<i>self</i>, QScriptString&#160;<i>other</i>)</li><li><div class="fn" />int <b><a href="qscriptstring.html#__hash__">__hash__</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptstring.html#__ne__">__ne__</a></b> (<i>self</i>, QScriptString&#160;<i>other</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QScriptString class acts as a handle to "interned" strings
in a <a href="qscriptengine.html">QScriptEngine</a>.</p>
<p>QScriptString can be used to achieve faster (repeated) property
getting/setting, and comparison of property names, of script
objects.</p>
<p>To get a QScriptString representation of a string, pass the
string to <a href="qscriptengine.html#toStringHandle">QScriptEngine.toStringHandle</a>().
The typical usage pattern is to register one or more pre-defined
strings when setting up your script environment, then subsequently
use the relevant QScriptString as argument to e.g. <a href="qscriptvalue.html#property">QScriptValue.property</a>().</p>
<p>Call the <a href="qscriptstring.html#toString">toString</a>()
function to obtain the string that a QScriptString represents.</p>
<p>Call the <a href="qscriptstring.html#toArrayIndex">toArrayIndex</a>() function to
convert a QScriptString to an array index. This is useful when
using <a href="qscriptclass.html">QScriptClass</a> to implement
array-like objects.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QScriptString" />QScriptString.__init__ (<i>self</i>)</h3><p>Constructs an invalid <a href="qscriptstring.html">QScriptString</a>.</p>


<h3 class="fn"><a name="QScriptString-2" />QScriptString.__init__ (<i>self</i>, <a href="qscriptstring.html">QScriptString</a>&#160;<i>other</i>)</h3><p>Constructs a new <a href="qscriptstring.html">QScriptString</a>
that is a copy of <i>other</i>.</p>


<h3 class="fn"><a name="isValid" />bool QScriptString.isValid (<i>self</i>)</h3><p>Returns true if this <a href="qscriptstring.html">QScriptString</a> is valid; otherwise returns
false.</p>


<h3 class="fn"><a name="toArrayIndex" />(int, bool&#160;<i>ok</i>) QScriptString.toArrayIndex (<i>self</i>)</h3><p>Attempts to convert this <a href="qscriptstring.html">QScriptString</a> to a <a href="qtscript.html">QtScript</a> array index, and returns the
result.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false;
otherwise *<i>ok</i> is set to true.</p>
<p>This function was introduced in Qt 4.6.</p>


<h3 class="fn"><a name="toString" />QString QScriptString.toString (<i>self</i>)</h3><p>Returns the string that this <a href="qscriptstring.html">QScriptString</a> represents, or a null string
if this <a href="qscriptstring.html">QScriptString</a> is not
valid.</p>
<p><b>See also</b> <a href="qscriptstring.html#isValid">isValid</a>().</p>


<h3 class="fn"><a name="__eq__" />bool QScriptString.__eq__ (<i>self</i>, <a href="qscriptstring.html">QScriptString</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__hash__" />int QScriptString.__hash__ (<i>self</i>)</h3><h3 class="fn"><a name="__ne__" />bool QScriptString.__ne__ (<i>self</i>, <a href="qscriptstring.html">QScriptString</a>&#160;<i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>